<?php

/**
 * This is the model class for table "d_soutput".
 *
 * The followings are the available columns in table 'd_soutput':
 * @property integer $ID
 * @property string $THANG
 * @property string $KDJENDOK
 * @property string $KDSATKER
 * @property string $KDDEPT
 * @property string $KDUNIT
 * @property string $KDPROGRAM
 * @property string $KDGIAT
 * @property string $KDOUTPUT
 * @property string $KDLOKASI
 * @property string $KDKABKOTA
 * @property string $KDDEKON
 * @property string $KDSOUTPUT
 * @property string $URSOUTPUT
 * @property integer $SBMKVOL
 * @property string $SBMKSAT
 * @property integer $SBMKMIN1
 * @property string $SBMKKET
 * @property string $KDSB
 * @property double $VOLSOUT
 * @property string $KDIB
 * @property string $_NullFlags
 */
class DSoutput extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return DSoutput the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'd_soutput';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('SBMKVOL, SBMKMIN1', 'numerical', 'integerOnly'=>true),
			array('VOLSOUT', 'numerical'),
			array('THANG, KDGIAT', 'length', 'max'=>4),
			array('KDJENDOK, KDUNIT, KDPROGRAM, KDLOKASI, KDKABKOTA, KDIB', 'length', 'max'=>2),
			array('KDSATKER', 'length', 'max'=>6),
			array('KDDEPT, KDOUTPUT, KDSOUTPUT', 'length', 'max'=>3),
			array('KDDEKON, KDSB', 'length', 'max'=>1),
			array('URSOUTPUT, SBMKKET', 'length', 'max'=>250),
			array('SBMKSAT', 'length', 'max'=>25),
			array('_NullFlags', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('ID, THANG, KDJENDOK, KDSATKER, KDDEPT, KDUNIT, KDPROGRAM, KDGIAT, KDOUTPUT, KDLOKASI, KDKABKOTA, KDDEKON, KDSOUTPUT, URSOUTPUT, SBMKVOL, SBMKSAT, SBMKMIN1, SBMKKET, KDSB, VOLSOUT, KDIB, _NullFlags', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
                    'program' => array(self::BELONGS_TO, 'TProgram', 'KDPROGRAM'),
                    'giat' => array(self::BELONGS_TO, 'TGiat', 'KDGIAT'),
                    'dept' => array(self::BELONGS_TO, 'TDept', 'KDDEPT'),
                    'satker' => array(self::BELONGS_TO, 'TSatker', 'KDSATKER'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'ID' => 'ID',
			'THANG' => 'TH Anggaran',
			'KDJENDOK' => 'Kdjendok',
			'KDSATKER' => 'Satker',
			'KDDEPT' => 'Departemen',
			'KDUNIT' => 'Kdunit',
			'KDPROGRAM' => 'Program',
			'KDGIAT' => 'Giat',
			'KDOUTPUT' => 'Kd Output',
			'KDLOKASI' => 'Kdlokasi',
			'KDKABKOTA' => 'Kdkabkota',
			'KDDEKON' => 'Kddekon',
			'KDSOUTPUT' => 'Kd Soutput',
			'URSOUTPUT' => 'Ursoutput',
			'SBMKVOL' => 'Sbmkvol',
			'SBMKSAT' => 'Sbmksat',
			'SBMKMIN1' => 'Sbmkmin1',
			'SBMKKET' => 'Sbmkket',
			'KDSB' => 'Kdsb',
			'VOLSOUT' => 'Volsout',
			'KDIB' => 'Kdib',
			'_NullFlags' => 'Null Flags',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('ID',$this->ID);
		$criteria->compare('THANG',$this->THANG,true);
		$criteria->compare('KDJENDOK',$this->KDJENDOK,true);
		$criteria->compare('KDSATKER',$this->KDSATKER,true);
		$criteria->compare('KDDEPT',$this->KDDEPT,true);
		$criteria->compare('KDUNIT',$this->KDUNIT,true);
		$criteria->compare('KDPROGRAM',$this->KDPROGRAM,true);
		$criteria->compare('KDGIAT',$this->KDGIAT,true);
		$criteria->compare('KDOUTPUT',$this->KDOUTPUT,true);
		$criteria->compare('KDLOKASI',$this->KDLOKASI,true);
		$criteria->compare('KDKABKOTA',$this->KDKABKOTA,true);
		$criteria->compare('KDDEKON',$this->KDDEKON,true);
		$criteria->compare('KDSOUTPUT',$this->KDSOUTPUT,true);
		$criteria->compare('URSOUTPUT',$this->URSOUTPUT,true);
		$criteria->compare('SBMKVOL',$this->SBMKVOL);
		$criteria->compare('SBMKSAT',$this->SBMKSAT,true);
		$criteria->compare('SBMKMIN1',$this->SBMKMIN1);
		$criteria->compare('SBMKKET',$this->SBMKKET,true);
		$criteria->compare('KDSB',$this->KDSB,true);
		$criteria->compare('VOLSOUT',$this->VOLSOUT);
		$criteria->compare('KDIB',$this->KDIB,true);
		$criteria->compare('_NullFlags',$this->_NullFlags,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}